<script language="JavaScript" type="text/javascript" src="<?=base_url();?>public/administrator/js/cart/category.js"></script>
<p>&nbsp;</p>
<form action="processCategory.php?action=addCategory" method="post"  name="frmListCategory" id="frmListCategory">
 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="text">
  <tr align="center" id="listTableHeader"> 
   <td>Category Name</td>
   <td>Description</td>
   <td width="75">Image</td>
   <td width="75">Modify</td>
   <td width="75">Delete</td>
  </tr>
  <?php
  $Maxcat=1;
$cat_parent_id = 0;
if ($query->num_rows() > 0) {
	$i = 0;
	
	 foreach ($query->result() as $row) {
		//extract($row);
		if ($i%2) {
			$class = 'row1';
		} else {
			$class = 'row2';
		}
		
		$i += 1;
		
		if ($cat_parent_id == 0) {
			$cat_name = "<a href=\"index.php?catId=$row->cat_id\">$row->cat_name</a>";
		}
		
		if ($row->cat_image) {
			$cat_image =  base_url() . 'public/picture/category/' . $row->cat_image;
		} else {
			$cat_image = base_url() . 'public/picture/no-image-small.png';
		}		
?>
  <tr class="<?php echo $class; ?>"> 
   <td><?php echo $cat_name; ?></td>
   <td><?php echo nl2br($row->cat_description); ?></td>
   <td width="75" align="center"><img src="<?php echo $cat_image; ?>"></td>
   <td width="75" align="center"><a href="javascript:modifyCategory(<?php echo $row->cat_id; ?>);">Modify</a></td>
   <td width="75" align="center"><a href="javascript:deleteCategory(<?php echo $row->cat_id; ?>);">Delete</a></td>
  </tr>
  <?php
   $Maxcat=$row->cat_id;
	} // end while


?>
  <tr> 
   <td colspan="5" align="center">
   <?php 
  // echo $pagingLink;
   ?></td>
  </tr>
<?php	
} else {
?>
  <tr> 
   <td colspan="5" align="center">No Categories Yet</td>
  </tr>
  <?php
}
?>
  <tr> 
   <td colspan="5">&nbsp;</td>
  </tr>
  <tr> 
   <td colspan="5" align="right">
   <input name="btnAddCategory" type="button" id="btnAddCategory" value="Add Category" class="box" onClick="addCategory(<?php echo $Maxcat;?>)"> 
   </td>
  </tr>
 </table>
 <p>&nbsp;</p>
</form>